package com.prig.base.exctption;

import com.prig.base.util.response.Result;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 异常处理
 */
@RestControllerAdvice
public class ExceptionHandle {

    @ExceptionHandler(AuthorizationException.class)
    public Result handleAuthorizationException(){
        return new Result().c400("没有权限访问");
    }
    @ExceptionHandler(MethodArgumentNotValidException.class)
    public Result handle(){
        return new Result().c400("参数错误");
    }

}
